import { reqEquipmentByPage, reqGetRoomList } from "@/api"
import { Message } from "element-ui";
export default({
    namespaced:true,
    actions:{
        async getRoomList(context,value){
            let result=await reqGetRoomList();
            if(result.code==='200'){
                context.commit('getRoomList',result.other)
            }else{
                Message({
                    message: '警告!'+'['+result.code+']'+'['+result.message+']',
                    type: 'warning'
                })
                return;
            }
        },
        async getEquipmentByPage(context,value){
            let result=await reqEquipmentByPage(value);
            if(result.code==='200'){
                context.commit('getEquipmentByPage',result.other)
            }else{
                Message({
                    message: '警告!'+'['+result.code+']'+'['+result.message+']',
                    type: 'warning'
                })
                return;
            }
        }
    },
    mutations:{
        getRoomList(state,value){
            state.roomList=value
        },
        getEquipmentByPage(state,value){
            state.equipmentList=value.list;
            state.equipmentRows=value.rows;
        }
    },
    state:{
        roomList:[],
        equipmentList:[],
        equipmentRows:0
    },
    getters:{

    }
})